<html>
<head><meta charset="utf-8"><title>weird issues with finding trait implementations · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html">weird issues with finding trait implementations</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="204313086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204313086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204313086">(Jul 18 2020 at 18:52)</a>:</h4>
<p>Summarizing the major points from <a href="https://discordapp.com/channels/442252698964721669/459149231702278154/734115963082899517">https://discordapp.com/channels/442252698964721669/459149231702278154/734115963082899517</a>:</p>
<ul>
<li><code>all_impls</code> isn't returning all the impls (in particular, it's certainly missing <code>impl Into&lt;String&gt; for String</code>)</li>
<li><code>inherent_impls</code> is returning an impl not found by <code>all_impls</code>: <code>DefId(5:3595 ~ alloc[b674]::string[0]::{{impl}}[0])</code></li>
<li>I can't give you a better name for that impl because trying to do so panics: <code>error: internal compiler error: src/librustc_middle/ty/mod.rs:2925:21: item_name: no name for DefPath { data: [DisambiguatedDefPathData { data: TypeNs("string"), disambiguator: 0 }, DisambiguatedDefPathData { data: Impl, disambiguator: 0 }], krate: crate5 }</code></li>
</ul>
<p>Any ideas?</p>



<a name="204313095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204313095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204313095">(Jul 18 2020 at 18:52)</a>:</h4>
<p>for context, we're trying to fix a bug where <code>String::from</code> doesn't resolve in intra-doc links</p>



<a name="204313166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204313166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204313166">(Jul 18 2020 at 18:54)</a>:</h4>
<p>oh hold on I think I need to call <code>trait_id_of_impl</code> to print the name</p>



<a name="204317061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204317061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204317061">(Jul 18 2020 at 20:47)</a>:</h4>
<p>I figured this out, see vaguely <a href="https://discordapp.com/channels/442252698964721669/459149231702278154/734122117095882783">https://discordapp.com/channels/442252698964721669/459149231702278154/734122117095882783</a></p>



<a name="204319788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204319788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204319788">(Jul 18 2020 at 22:00)</a>:</h4>
<p>ok it turns out the issue is that <code>all_impls</code> takes a _trait_, not a _type_</p>



<a name="204319793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204319793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204319793">(Jul 18 2020 at 22:00)</a>:</h4>
<p>is there a cheap way to get all traits that a _type_ implements?</p>



<a name="204319806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204319806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204319806">(Jul 18 2020 at 22:01)</a>:</h4>
<p>the best I've found is going through every trait from every crate one at a time which doesn't seem right</p>



<a name="204381571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381571">(Jul 20 2020 at 02:35)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> in case you're still wondering: it is right. although I already linked this on Discord: <a href="https://github.com/rust-lang/rust/blob/d7f94516345a36ddfcd68cbdf1df835d356795c3/src/librustc_trait_selection/traits/error_reporting/mod.rs#L1395-L1414">https://github.com/rust-lang/rust/blob/d7f94516345a36ddfcd68cbdf1df835d356795c3/src/librustc_trait_selection/traits/error_reporting/mod.rs#L1395-L1414</a></p>



<a name="204381578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381578">(Jul 20 2020 at 02:35)</a>:</h4>
<p>I was actually just starting to work on this again haha</p>



<a name="204381580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381580">(Jul 20 2020 at 02:36)</a>:</h4>
<p>this seems kind of slow?</p>



<a name="204381618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381618">(Jul 20 2020 at 02:36)</a>:</h4>
<p>the situation with inherent impls is the wrong one, actually. when you say "type" you presumably mean a <code>struct</code>/<code>enum</code>/<code>union</code>, right?</p>



<a name="204381620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381620">(Jul 20 2020 at 02:36)</a>:</h4>
<p>right</p>



<a name="204381623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381623">(Jul 20 2020 at 02:36)</a>:</h4>
<p>(I think)</p>



<a name="204381625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381625">(Jul 20 2020 at 02:36)</a>:</h4>
<p>anything that <code>Type::item</code> is valid for</p>



<a name="204381626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381626">(Jul 20 2020 at 02:36)</a>:</h4>
<p>that's not what "implements" a trait, and so asking for impls "of it" is not something fundamental(ly meaningful)</p>



<a name="204381631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381631">(Jul 20 2020 at 02:37)</a>:</h4>
<p>wait, what? don't types implement traits?</p>



<a name="204381639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381639">(Jul 20 2020 at 02:37)</a>:</h4>
<p>semantic types implement traits, and your path example is misleading because it desugars  to <code>&lt;Type&lt;..&gt;&gt;::item</code></p>



<a name="204381643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381643">(Jul 20 2020 at 02:37)</a>:</h4>
<p>What's a semantic type?</p>



<a name="204381683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381683">(Jul 20 2020 at 02:38)</a>:</h4>
<p>typesystem types. where e.g. type aliases don't matter. <code>ty::Ty</code></p>



<a name="204381687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381687">(Jul 20 2020 at 02:38)</a>:</h4>
<p>the only thing that's sort of pre-typesystem about (trait) impls is the trait. that's why you can find impls by trait</p>



<a name="204381697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381697">(Jul 20 2020 at 02:39)</a>:</h4>
<p>ok, so if I run <code>tcx.type_of(def_id)</code>, can I get the traits that semantic type implements?</p>



<a name="204381715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381715">(Jul 20 2020 at 02:40)</a>:</h4>
<p>not without going through all the traits in the world, taking every single one of their impls, and comparing them against that type</p>



<a name="204381753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381753">(Jul 20 2020 at 02:40)</a>:</h4>
<p>well, time to make the CPU cache very unhappy</p>



<a name="204381757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381757">(Jul 20 2020 at 02:40)</a>:</h4>
<p>there's not really any other way the trait system <em>can</em> work, because the type can <em>any type</em></p>



<a name="204381763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381763">(Jul 20 2020 at 02:41)</a>:</h4>
<p>inherent impls we've managed to keep lying for because we restrict what they can go on</p>



<a name="204381767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381767">(Jul 20 2020 at 02:41)</a>:</h4>
<p>also ugh I feel like I'm explaining this very poorly</p>



<a name="204381784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381784">(Jul 20 2020 at 02:41)</a>:</h4>
<p>I think I understand what you're saying</p>



<a name="204381786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381786">(Jul 20 2020 at 02:41)</a>:</h4>
<p>if all you could write is <code>impl Trait for AStructOrEnumOrUnion</code> then yes there would make sense to be a mapping</p>



<a name="204381787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381787">(Jul 20 2020 at 02:41)</a>:</h4>
<p>I'm just not understanding the design decisions that make adding this hard</p>



<a name="204381826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381826">(Jul 20 2020 at 02:42)</a>:</h4>
<p>but you can implement a trait for <code>(&amp;i32, Vec&lt;Foo&gt;)</code></p>



<a name="204381828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381828">(Jul 20 2020 at 02:42)</a>:</h4>
<p>and that doesn't have a <code>DefId</code>, it can only be represented by a<code>Ty</code></p>



<a name="204381831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381831">(Jul 20 2020 at 02:42)</a>:</h4>
<p>hmm</p>



<a name="204381834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381834">(Jul 20 2020 at 02:42)</a>:</h4>
<p>and when generics are involved, you end up with <em>patterns</em></p>



<a name="204381848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381848">(Jul 20 2020 at 02:43)</a>:</h4>
<p>not in the sense of <code>Pat</code> syntax in Rust, but more abstractly</p>



<a name="204381849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381849">(Jul 20 2020 at 02:43)</a>:</h4>
<p>I think I see, the query I'm imagining that goes from types to traits only works if you have a DefId</p>



<a name="204381854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381854">(Jul 20 2020 at 02:43)</a>:</h4>
<p>this is a shame because rustdoc will never have to deal with <code>(&amp;i32, Vec&lt;Foo&gt;)</code> :/</p>



<a name="204381866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381866">(Jul 20 2020 at 02:43)</a>:</h4>
<p>at least not for intra links</p>



<a name="204381907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381907">(Jul 20 2020 at 02:44)</a>:</h4>
<p>anyway, the <code>for_each_relevant_impl</code> query does a compromise: for each trait we cache the list of impls partitioned by a "simplified type"</p>



<a name="204381922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381922">(Jul 20 2020 at 02:45)</a>:</h4>
<p>(and if one is impossible to derive from the semantic type, it's treated as "blanket". so every time you look for a specific <code>struct</code>'s impl, you'll get all the e.g. <code>impl&lt;T&gt; From&lt;Foo&gt; for T</code> impls)</p>



<a name="204381924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381924">(Jul 20 2020 at 02:45)</a>:</h4>
<p>(because there's no way to tell you <em>don't</em> want those impls)</p>



<a name="204381937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381937">(Jul 20 2020 at 02:46)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> okay waking up enough to formulate the other constraints: the crate graph can form "diamonds"</p>



<a name="204381983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381983">(Jul 20 2020 at 02:46)</a>:</h4>
<div class="codehilite"><pre><span></span><code>    a
  /   \
 b     c
  \   /
    d
</code></pre></div>



<a name="204381984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381984">(Jul 20 2020 at 02:46)</a>:</h4>
<p>this sort of shape of dependencies</p>



<a name="204381988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204381988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204381988">(Jul 20 2020 at 02:46)</a>:</h4>
<p>sure</p>



<a name="204382001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382001">(Jul 20 2020 at 02:47)</a>:</h4>
<p>so you can't do arbitrary indexing <em>even with</em> the "simplified types" trick</p>



<a name="204382024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382024">(Jul 20 2020 at 02:48)</a>:</h4>
<p>without putting a lot of work on every crate to combine together all the traits' impls into one big indexed map</p>



<a name="204382069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382069">(Jul 20 2020 at 02:48)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> furthermore, this is <em>never</em> needed (outside of diagnostics), as you either have to name the trait or have it in scope, in order to use it, normally</p>



<a name="204382070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382070">(Jul 20 2020 at 02:48)</a>:</h4>
<p>because a downstream crate can implement a local trait for a foreign type, right</p>



<a name="204382076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382076">(Jul 20 2020 at 02:48)</a>:</h4>
<p>ok it's starting to make sense why this can't be done cheaply</p>



<a name="204382092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382092">(Jul 20 2020 at 02:49)</a>:</h4>
<p>ideally we'd have a very fancy pattern-indexed thing. and maybe Chalk can do some of that (not sure), but it would likely still be partitioned by traits just because of how much less effort that makes things</p>



<a name="204382093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382093">(Jul 20 2020 at 02:49)</a>:</h4>
<p>sorry for starting at the (arguably) wrong tail-end of this</p>



<a name="204382098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382098">(Jul 20 2020 at 02:49)</a>:</h4>
<p>you're good, I was doing some code munging in the meantime</p>



<a name="204382171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382171">(Jul 20 2020 at 02:51)</a>:</h4>
<p>adding back inherent impls since apparently it was very incorrect to remove those lookups lol</p>



<a name="204382177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382177">(Jul 20 2020 at 02:51)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> oh btw it's not an ambiguity to have both inherent and trait available. the inherent will always take precedence</p>



<a name="204382181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382181">(Jul 20 2020 at 02:51)</a>:</h4>
<p>(and you specify the trait one by <code>Trait::method</code> or <code>&lt;T as Trait&gt;::method</code> etc.)</p>



<a name="204382193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382193">(Jul 20 2020 at 02:52)</a>:</h4>
<p>the issue is that rustdoc doesn't currently support <code>&lt;T as Trait&gt;</code></p>



<a name="204382229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382229">(Jul 20 2020 at 02:52)</a>:</h4>
<p>so you probably want to use that same logic</p>



<a name="204382242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382242">(Jul 20 2020 at 02:52)</a>:</h4>
<p>so even though it's not ambiguous in the language it's ambiguous in the context of intra-doc links</p>



<a name="204382245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382245">(Jul 20 2020 at 02:52)</a>:</h4>
<p>well, no, the trait one should just not be reachable :P</p>



<a name="204382252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382252">(Jul 20 2020 at 02:52)</a>:</h4>
<p>well yeah but that's not ideal either lol</p>



<a name="204382254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382254">(Jul 20 2020 at 02:52)</a>:</h4>
<p>unless you have examples where this is a problem?</p>



<a name="204382265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382265">(Jul 20 2020 at 02:53)</a>:</h4>
<p>it just seems unfortunate to have an item that's unreachable</p>



<a name="204382572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382572">(Jul 20 2020 at 03:02)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> so I see two ways this is currently done: in <code>rustc_trait_selection::error_reporting</code> it calls <code>all_traits</code>, then <code>for_each_relevant_impl</code> on each trait. But in <code>rustdoc::collect_trait_impls</code> it calls <code>all_trait_implementations</code> instead: <a href="https://github.com/rust-lang/rust/blob/master/src/librustdoc/passes/collect_trait_impls.rs#L30">https://github.com/rust-lang/rust/blob/master/src/librustdoc/passes/collect_trait_impls.rs#L30</a>. Which should I use?</p>



<a name="204382638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382638">(Jul 20 2020 at 03:03)</a>:</h4>
<p>I'll go with <code>for_each_relevant_impl</code> since you said it was indexed by the type</p>



<a name="204382640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382640">(Jul 20 2020 at 03:04)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> <code>all_trait_implementations</code> doesn't give you <em>any</em> indexing so yeah</p>



<a name="204382721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382721">(Jul 20 2020 at 03:05)</a>:</h4>
<p>actually I can filter this even more by skipping traits that don't have this associated item</p>



<a name="204382760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382760">(Jul 20 2020 at 03:06)</a>:</h4>
<p>so then I don't need to look at each impl unless it's relevant</p>



<a name="204382766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382766">(Jul 20 2020 at 03:06)</a>:</h4>
<p>I kinda doubt <code>all_trait_implementations</code> is that useful now that I think about it hmm, since it shouldn't be slower to iterate the traits (since the total work is still linear in the number of total impls)</p>



<a name="204382776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382776">(Jul 20 2020 at 03:06)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> ah yeah! I remember suggesting that on Discord :P</p>



<a name="204382784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382784">(Jul 20 2020 at 03:07)</a>:</h4>
<p>the error reporting code filters by confusable trait path but in your case, the associated item is relevant</p>



<a name="204382785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382785">(Jul 20 2020 at 03:07)</a>:</h4>
<p>great minds think alike :P</p>



<a name="204382789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382789">(Jul 20 2020 at 03:07)</a>:</h4>
<p>I'd use <code>associated_items()</code> for that?</p>



<a name="204382830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382830">(Jul 20 2020 at 03:08)</a>:</h4>
<p>I think so? make sure it has an API to query by name</p>



<a name="204382838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382838">(Jul 20 2020 at 03:08)</a>:</h4>
<p>so that you don't have to iterate all the associated items before getting to look at their names</p>



<a name="204382843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382843">(Jul 20 2020 at 03:08)</a>:</h4>
<p>yup: <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.AssociatedItems.html#method.filter_by_name">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.AssociatedItems.html#method.filter_by_name</a></p>



<a name="204382860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382860">(Jul 20 2020 at 03:09)</a>:</h4>
<p>uh oh</p>
<blockquote>
<p>Multiple items may have the same name if they are in different Namespaces. For example, an associated type can have the same name as a method. Use one of the find_by_name_and_* methods below if you know which item you are looking for.</p>
</blockquote>



<a name="204382905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382905">(Jul 20 2020 at 03:10)</a>:</h4>
<p>you should use <code>.filter_by_name_unhygienic(name).next().is_some()</code></p>



<a name="204382907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382907">(Jul 20 2020 at 03:10)</a>:</h4>
<p>actually I already have a namespace argument so this works out</p>



<a name="204382909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382909">(Jul 20 2020 at 03:10)</a>:</h4>
<p>oh you do? hmm</p>



<a name="204382911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382911">(Jul 20 2020 at 03:10)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> I need the AssocKind of the item, not just that it exists</p>



<a name="204382916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382916">(Jul 20 2020 at 03:10)</a>:</h4>
<p>I still think you need to use the the unhygienic variant</p>



<a name="204382923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382923">(Jul 20 2020 at 03:10)</a>:</h4>
<p>but you could try to pass the <code>DefId</code> of the item being documented as <code>parent_def_id</code> if you can?</p>



<a name="204382926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382926">(Jul 20 2020 at 03:11)</a>:</h4>
<p>what's the difference between hygenic and unhygenic here?</p>



<a name="204382929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382929">(Jul 20 2020 at 03:11)</a>:</h4>
<p>macro hygiene</p>



<a name="204382938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382938">(Jul 20 2020 at 03:11)</a>:</h4>
<p>specifically for the case here of associated items, macros 2.0 (<code>macro foo {...}</code> or <code>macro foo(...) {...}</code>), not <code>macro_rules!</code></p>



<a name="204382980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382980">(Jul 20 2020 at 03:12)</a>:</h4>
<p>shouldn't parent_def_id be that of the trait?</p>



<a name="204382987"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382987" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382987">(Jul 20 2020 at 03:12)</a>:</h4>
<p>I doubt it's the parent of the associated item, since the associated item knows that itself</p>



<a name="204382998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204382998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204382998">(Jul 20 2020 at 03:12)</a>:</h4>
<p>ugh I might be wrong</p>



<a name="204383003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383003">(Jul 20 2020 at 03:13)</a>:</h4>
<p>the docs for this are non-existent lol</p>



<a name="204383004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383004">(Jul 20 2020 at 03:13)</a>:</h4>
<p>you have to guess from the types</p>



<a name="204383008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383008">(Jul 20 2020 at 03:13)</a>:</h4>
<p>yeah calls pass the trait <code>DefId</code>. I don't understand why though</p>



<a name="204383085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383085">(Jul 20 2020 at 03:15)</a>:</h4>
<p>like <code>AssociatedItems</code> could just contain that <code>DefId</code> if looking it up seems too expensive</p>



<a name="204383091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383091">(Jul 20 2020 at 03:15)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> lol they're not more efficient <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_middle/ty/mod.rs#L277-L316">https://github.com/rust-lang/rust/blob/master/src/librustc_middle/ty/mod.rs#L277-L316</a></p>



<a name="204383138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383138">(Jul 20 2020 at 03:16)</a>:</h4>
<p>so you should be fine with doing this unhygienically and filtering by namespace or w/e</p>



<a name="204383141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383141">(Jul 20 2020 at 03:16)</a>:</h4>
<p><span aria-label="face palm" class="emoji emoji-1f926" role="img" title="face palm">:face_palm:</span></p>



<a name="204383144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383144">(Jul 20 2020 at 03:16)</a>:</h4>
<p>it looks like <code>find_by_name_and_namespace</code> is what I want</p>



<a name="204383162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383162">(Jul 20 2020 at 03:17)</a>:</h4>
<p>oh that returns a single one. okay fine :P</p>



<a name="204383206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383206">(Jul 20 2020 at 03:18)</a>:</h4>
<p>this is what typeck does:</p>
<div class="codehilite"><pre><span></span><code><span class="n">tcx</span><span class="w"></span>
<span class="w">    </span><span class="p">.</span><span class="n">associated_items</span><span class="p">(</span><span class="n">def_id</span><span class="p">)</span><span class="w"></span>
<span class="w">    </span><span class="p">.</span><span class="n">find_by_name_and_namespace</span><span class="p">(</span><span class="n">tcx</span><span class="p">,</span><span class="w"> </span><span class="n">item_name</span><span class="p">,</span><span class="w"> </span><span class="n">ns</span><span class="p">,</span><span class="w"> </span><span class="n">def_id</span><span class="p">)</span><span class="w"></span>
<span class="w">    </span><span class="p">.</span><span class="n">copied</span><span class="p">()</span><span class="w"></span>
</code></pre></div>



<a name="204383210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383210">(Jul 20 2020 at 03:18)</a>:</h4>
<p>as usual, grepping is far more useful than docs :P</p>



<a name="204383225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383225">(Jul 20 2020 at 03:19)</a>:</h4>
<p>oh but you're filtering traits. so it's not like you need the <code>ty::AssocItem</code></p>



<a name="204383226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383226">(Jul 20 2020 at 03:19)</a>:</h4>
<p>how do I get info about the impl once I have it?</p>



<a name="204383229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383229">(Jul 20 2020 at 03:19)</a>:</h4>
<p>I want to know what type it's for</p>



<a name="204383230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383230">(Jul 20 2020 at 03:19)</a>:</h4>
<p>once you have it from <code>for_each_relevant_impl</code>?</p>



<a name="204383272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383272">(Jul 20 2020 at 03:20)</a>:</h4>
<p><code>impl_trait_ref</code> ideally but <code>impl_self_ty</code> also works IIRC</p>



<a name="204383305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383305">(Jul 20 2020 at 03:21)</a>:</h4>
<p>I don't see an impl_self_ty</p>



<a name="204383350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383350">(Jul 20 2020 at 03:22)</a>:</h4>
<p>oh right it wasn't made its own query lol</p>



<a name="204383353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383353">(Jul 20 2020 at 03:22)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> just use <code>impl_trait_ref</code> then</p>



<a name="204383355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383355">(Jul 20 2020 at 03:22)</a>:</h4>
<p>it's less confusing</p>



<a name="204383356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383356">(Jul 20 2020 at 03:22)</a>:</h4>
<p>wait, why does that return an Option??</p>



<a name="204383366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383366">(Jul 20 2020 at 03:22)</a>:</h4>
<p><code>None</code> for inherent impls</p>



<a name="204383371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383371">(Jul 20 2020 at 03:22)</a>:</h4>
<p>(you can unwrap it if you found it from a trait)</p>



<a name="204383577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383577">(Jul 20 2020 at 03:28)</a>:</h4>
<p>well it compiles at least</p>



<a name="204383578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383578">(Jul 20 2020 at 03:28)</a>:</h4>
<p>let me see if it actually works</p>



<a name="204383590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383590">(Jul 20 2020 at 03:29)</a>:</h4>
<p>it's just as complicated as I thought btw: <a href="https://hastebin.com/zeviyuxuco.js">https://hastebin.com/zeviyuxuco.js</a></p>



<a name="204383635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383635">(Jul 20 2020 at 03:30)</a>:</h4>
<p><code>if trait_ref.self_ty() == ty {</code> will not work heh</p>



<a name="204383637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383637">(Jul 20 2020 at 03:30)</a>:</h4>
<p>oh no :(</p>



<a name="204383638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383638">(Jul 20 2020 at 03:30)</a>:</h4>
<p>in general, don't <code>==</code> on <code>Ty</code> unless it's a fast-path</p>



<a name="204383642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383642">(Jul 20 2020 at 03:31)</a>:</h4>
<p>is there a deep_equals() or something?</p>



<a name="204383647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383647">(Jul 20 2020 at 03:31)</a>:</h4>
<p>think what happens if generics are involved and the trait impl used different names for the parameters than the definition</p>



<a name="204383650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383650">(Jul 20 2020 at 03:31)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> <code>relate</code> but doubtful you need it. where'd you get the <code>ty</code></p>



<a name="204383651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383651">(Jul 20 2020 at 03:31)</a>:</h4>
<p><code>tcx.type_of(def_id)</code></p>



<a name="204383656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383656">(Jul 20 2020 at 03:31)</a>:</h4>
<p>(or worse than parameter names: the <code>impl</code> is for specific types replacing some of the parameters)</p>



<a name="204383695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383695">(Jul 20 2020 at 03:32)</a>:</h4>
<p>okay so it's not an arbitrary type so you wouldn't need to do anything deep</p>



<a name="204383698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383698">(Jul 20 2020 at 03:32)</a>:</h4>
<p>just check for <code>ty::Adt(def, _)</code> and compare <code>def.did</code></p>



<a name="204383702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383702">(Jul 20 2020 at 03:32)</a>:</h4>
<p>this will effectively ignore blanket impls (which idk if you can do more efficiently otherwise)</p>



<a name="204383704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383704">(Jul 20 2020 at 03:32)</a>:</h4>
<p>lol it failed even earlier</p>
<div class="codehilite"><pre><span></span><code>$ rustdoc +stage1 str_from.rs
thread &#39;rustc&#39; panicked at &#39;assertion failed: `(left == right)`
  left: `crate1`,
 right: `crate0`&#39;, src/librustc_typeck/check/method/suggest.rs:1305:9
</code></pre></div>



<a name="204383723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383723">(Jul 20 2020 at 03:33)</a>:</h4>
<p>looks like <code>non_blanket_impls</code> is not exposed so there's not much you can do</p>



<a name="204383724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383724">(Jul 20 2020 at 03:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/weird.20issues.20with.20finding.20trait.20implementations/near/204383698">said</a>:</p>
<blockquote>
<p>just check for <code>ty::Adt(def, _)</code> and compare <code>def.did</code></p>
</blockquote>
<p>should i also check for <code>Foreign(def)</code>?</p>



<a name="204383767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383767">(Jul 20 2020 at 03:34)</a>:</h4>
<p>oh maybe. I keep forgetting</p>



<a name="204383772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383772">(Jul 20 2020 at 03:34)</a>:</h4>
<p>also do you want to support e.g. <code>i32::method</code>?</p>



<a name="204383793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383793">(Jul 20 2020 at 03:34)</a>:</h4>
<p>oh ugh I probably should</p>



<a name="204383797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383797">(Jul 20 2020 at 03:34)</a>:</h4>
<p>even though primitives are all sorts of broken right now</p>



<a name="204383798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383798">(Jul 20 2020 at 03:34)</a>:</h4>
<p>also you should ban this feature on type aliases</p>



<a name="204383812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383812">(Jul 20 2020 at 03:35)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> at least for the named primitives <code>==</code> will do what you need (since they have no parameters)</p>



<a name="204383866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383866">(Jul 20 2020 at 03:36)</a>:</h4>
<p>(the problem with type aliases is they can be arbitrarily complicated so checking if <code>TypeAlias::method</code> would resolve in typeck requires asking the trait system nicely, which is more effort)</p>



<a name="204383876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383876">(Jul 20 2020 at 03:36)</a>:</h4>
<p>yeah I just want an MVP for now lol</p>



<a name="204383882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383882">(Jul 20 2020 at 03:36)</a>:</h4>
<p>since before it was so broken it depended where in the crate you put the link lol</p>



<a name="204383884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204383884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204383884">(Jul 20 2020 at 03:37)</a>:</h4>
<p>so you can do <code>==</code> and fallback to comparing <code>ty::Adt</code>s</p>



<a name="204384006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384006">(Jul 20 2020 at 03:40)</a>:</h4>
<p>how's this?</p>
<div class="codehilite"><pre><span></span><code><span class="w">                    </span><span class="kd">let</span><span class="w"> </span><span class="n">trait_ref</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">cx</span><span class="p">.</span><span class="n">tcx</span><span class="p">.</span><span class="n">impl_trait_ref</span><span class="p">(</span><span class="n">impl_</span><span class="p">).</span><span class="n">expect</span><span class="p">(</span><span class="s">&quot;this is not an inherent impl&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">                    </span><span class="c1">// Check if these are the same type.</span>
<span class="w">                    </span><span class="kd">let</span><span class="w"> </span><span class="n">impl_type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">trait_ref</span><span class="p">.</span><span class="n">self_ty</span><span class="p">();</span><span class="w"></span>
<span class="w">                    </span><span class="c1">// Fast path: if this is a primitive simple `==` will work</span>
<span class="w">                    </span><span class="kd">let</span><span class="w"> </span><span class="n">same_type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">impl_type</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">ty</span><span class="p">)</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="k">match</span><span class="w"> </span><span class="n">impl_type</span><span class="p">.</span><span class="n">kind</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                        </span><span class="c1">// Check if these are the same def_id</span>
<span class="w">                        </span><span class="n">TyKind</span>::<span class="n">Adt</span><span class="p">(</span><span class="n">def</span><span class="p">,</span><span class="w"> </span><span class="n">_</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">def</span><span class="p">.</span><span class="n">did</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">did</span><span class="p">,</span><span class="w"></span>
<span class="w">                        </span><span class="n">TyKind</span>::<span class="n">Foreign</span><span class="p">(</span><span class="n">def_id</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">def_id</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">did</span><span class="p">,</span><span class="w"></span>
<span class="w">                        </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w"></span>
<span class="w">                    </span><span class="p">};</span><span class="w"></span>
</code></pre></div>



<a name="204384011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384011">(Jul 20 2020 at 03:40)</a>:</h4>
<p>does that not warn about unnecessary parens? :P</p>



<a name="204384018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384018">(Jul 20 2020 at 03:41)</a>:</h4>
<p>I don't want to remember whether == or || has higher precedence lol</p>



<a name="204384025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384025">(Jul 20 2020 at 03:41)</a>:</h4>
<p><code>||</code> and <code>&amp;&amp;</code>  can't mess with comparisons</p>



<a name="204384027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384027">(Jul 20 2020 at 03:41)</a>:</h4>
<p>ok same panic as before</p>



<a name="204384030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384030">(Jul 20 2020 at 03:41)</a>:</h4>
<p>(unsurprisingly)</p>



<a name="204384031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384031">(Jul 20 2020 at 03:41)</a>:</h4>
<p>since <code>if</code> conditions are <code>||</code> of <code>&amp;&amp;</code> of comparisons, without parens, lol</p>



<a name="204384037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384037">(Jul 20 2020 at 03:41)</a>:</h4>
<p>like that's what they're "optimized" for :P</p>



<a name="204384084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384084">(Jul 20 2020 at 03:42)</a>:</h4>
<div class="codehilite"><pre><span></span><code>thread &#39;rustc&#39; panicked at &#39;assertion failed: `(left == right)`
  left: `crate1`,
 right: `crate0`&#39;, src/librustc_typeck/check/method/suggest.rs:1305:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

query stack during panic:
#0 [all_traits] fetching all foreign and local traits
end of query stack
</code></pre></div>



<a name="204384097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384097">(Jul 20 2020 at 03:42)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> wait how are you calling that? the suggestions code uses <code>all_traits(LOCAL_CRATE)</code></p>



<a name="204384100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384100">(Jul 20 2020 at 03:43)</a>:</h4>
<p>... please don't tell me this only works for the local crate</p>



<a name="204384105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384105">(Jul 20 2020 at 03:43)</a>:</h4>
<p>it's a nulary query</p>



<a name="204384106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384106">(Jul 20 2020 at 03:43)</a>:</h4>
<p>oh wait we only care about traits available for the current crate</p>



<a name="204384108"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384108" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384108">(Jul 20 2020 at 03:43)</a>:</h4>
<p>we should just make it <code>tcx.all_traits()</code> but nobody has done it yet</p>



<a name="204384109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384109">(Jul 20 2020 at 03:43)</a>:</h4>
<p>... why would it take a parameter if it's just going to ignore it lol</p>



<a name="204384110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384110">(Jul 20 2020 at 03:43)</a>:</h4>
<p>ok yeah</p>



<a name="204384111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384111">(Jul 20 2020 at 03:43)</a>:</h4>
<p>because queries started out as a macro making memoization cleaner :P</p>



<a name="204384153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384153">(Jul 20 2020 at 03:44)</a>:</h4>
<p>and it has to figure out which crate to compute the query "relative to"</p>



<a name="204384246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384246">(Jul 20 2020 at 03:47)</a>:</h4>
<blockquote>
<p>warning: <code>[std::collections::BTreeMap::into_iter]</code> cannot be resolved, ignoring it.</p>
</blockquote>
<p>great</p>



<a name="204384349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384349">(Jul 20 2020 at 03:50)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/weird.20issues.20with.20finding.20trait.20implementations/near/204383812">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> at least for the named primitives <code>==</code> will do what you need (since they have no parameters)</p>
</blockquote>
<p>hold on, primitives don't have a def_id</p>



<a name="204384353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384353">(Jul 20 2020 at 03:50)</a>:</h4>
<p>so since I got the type from a def id it will never be a primitive</p>



<a name="204384359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384359">(Jul 20 2020 at 03:51)</a>:</h4>
<p>so you're just not supporting them, right :P</p>



<a name="204384365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384365">(Jul 20 2020 at 03:51)</a>:</h4>
<p>works for me</p>



<a name="204384370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384370">(Jul 20 2020 at 03:51)</a>:</h4>
<p>if you start with a <code>Res</code>, you should be able to support them</p>



<a name="204384374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384374">(Jul 20 2020 at 03:51)</a>:</h4>
<p>(by handling cases other than <code>Res::Def</code>)</p>



<a name="204384380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384380">(Jul 20 2020 at 03:51)</a>:</h4>
<p>ah yup you're right</p>



<a name="204384381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384381">(Jul 20 2020 at 03:52)</a>:</h4>
<p>I'll fix it up later</p>



<a name="204384449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384449">(Jul 20 2020 at 03:53)</a>:</h4>
<p>ooh I just realized, even though into_iter doesn't work the explicit impl did :) <code>impl MyTrait for MyType</code></p>



<a name="204384454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384454">(Jul 20 2020 at 03:54)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="k">pub</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">T1</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">method</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="sd">/// See [S::method]</span>
<span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">S</span><span class="p">;</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="n">T1</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">S</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// [S::method] on method</span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">method</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="204384492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384492">(Jul 20 2020 at 03:54)</a>:</h4>
<p>add a type parameter, curious if that works</p>



<a name="204384493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384493">(Jul 20 2020 at 03:54)</a>:</h4>
<p>and/or a trait from a different crate</p>



<a name="204384497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384497">(Jul 20 2020 at 03:54)</a>:</h4>
<p>different crate definitely doesn't work</p>
<blockquote>
<p>warning: <code>[std::collections::BTreeMap::into_iter]</code> cannot be resolved, ignoring it.</p>
</blockquote>



<a name="204384498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384498">(Jul 20 2020 at 03:55)</a>:</h4>
<p>not like that, in your test</p>



<a name="204384502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384502">(Jul 20 2020 at 03:55)</a>:</h4>
<p>assume that the most general case is hopelessly broken in 3 different ways</p>



<a name="204384503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384503">(Jul 20 2020 at 03:55)</a>:</h4>
<p>so test things one at a time</p>



<a name="204384505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384505">(Jul 20 2020 at 03:55)</a>:</h4>
<p>I see</p>



<a name="204384508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384508">(Jul 20 2020 at 03:55)</a>:</h4>
<p>like, modify one variable at a time. that <code>BTreeMap</code> example has alloc type, core trait, and the type is generic,</p>



<a name="204384579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384579">(Jul 20 2020 at 03:57)</a>:</h4>
<p>this also fails:</p>
<div class="codehilite"><pre><span></span><code>/// Link to [S], [S::clone]
pub struct S;

impl Clone for S {
    fn clone(&amp;self) -&gt; Self {
        S
    }
}
</code></pre></div>



<a name="204384582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384582">(Jul 20 2020 at 03:57)</a>:</h4>
<p>this is worrying</p>



<a name="204384583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384583">(Jul 20 2020 at 03:57)</a>:</h4>
<blockquote>
<p>warning: <code>[S::clone]</code> cannot be resolved, ignoring it.</p>
</blockquote>



<a name="204384632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384632">(Jul 20 2020 at 03:58)</a>:</h4>
<p>well it's looking at the items so it's probably a bug in my code</p>
<div class="codehilite"><pre><span></span><code>[DEBUG rustdoc::passes::collect_intra_doc_links] considering explicit impl for trait DefId(2:1636 ~ core[92f6]::clone[0]::Clone[0])
[DEBUG rustdoc::passes::collect_intra_doc_links] considering item (DefId(2:1637 ~ core[92f6]::clone[0]::Clone[0]::clone[0]), Fn)
[DEBUG rustdoc::passes::collect_intra_doc_links] considering type &amp;T
[DEBUG rustdoc::passes::collect_intra_doc_links] considering type &amp;mut T
[DEBUG rustdoc::passes::collect_intra_doc_links] considering type S
</code></pre></div>



<a name="204384636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384636">(Jul 20 2020 at 03:59)</a>:</h4>
<p>ugh <code>all_traits</code> is implemented by diagnostic logic, this is worrying</p>



<a name="204384643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384643">(Jul 20 2020 at 03:59)</a>:</h4>
<p>maybe I need to check more type kinds?</p>



<a name="204384644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384644">(Jul 20 2020 at 03:59)</a>:</h4>
<p>but it does handle cross-crate</p>



<a name="204384648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384648">(Jul 20 2020 at 03:59)</a>:</h4>
<p><code>struct</code> is <code>ty::Adt</code> though</p>



<a name="204384649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384649">(Jul 20 2020 at 03:59)</a>:</h4>
<p>let me use debug printing for the types</p>



<a name="204384657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384657">(Jul 20 2020 at 03:59)</a>:</h4>
<p>that does nothing</p>



<a name="204384704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384704">(Jul 20 2020 at 04:00)</a>:</h4>
<p>you can at most name your struct something that's not confusable. but assuming it's <code>S</code> it should work</p>



<a name="204384733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384733">(Jul 20 2020 at 04:01)</a>:</h4>
<p>also, <code>s/TyKind::/ty::</code>, idk why you don't get an internal warning for that</p>



<a name="204384737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384737">(Jul 20 2020 at 04:01)</a>:</h4>
<p>you are correct that debug printing does nothing</p>



<a name="204384742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384742">(Jul 20 2020 at 04:01)</a>:</h4>
<p>I changed the name to <code>MyStruct</code> but basically the same as before</p>
<div class="codehilite"><pre><span></span><code>[DEBUG rustdoc::passes::collect_intra_doc_links] considering explicit impl for trait
DefId(2:1636 ~ core[92f6]::clone[0]::Clone[0])
[DEBUG rustdoc::passes::collect_intra_doc_links] considering item (DefId(2:1637 ~ cor
e[92f6]::clone[0]::Clone[0]::clone[0]), Fn)
[DEBUG rustdoc::passes::collect_intra_doc_links] considering type &amp;T
[DEBUG rustdoc::passes::collect_intra_doc_links] considering type &amp;mut T
[DEBUG rustdoc::passes::collect_intra_doc_links] considering type MyStruct
</code></pre></div>



<a name="204384746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384746">(Jul 20 2020 at 04:01)</a>:</h4>
<p>okay I think I know what the problem is</p>



<a name="204384787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384787">(Jul 20 2020 at 04:02)</a>:</h4>
<p>make it <code>struct MyStruct { foo: () }</code></p>



<a name="204384789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384789">(Jul 20 2020 at 04:02)</a>:</h4>
<p>that might just work</p>



<a name="204384810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384810">(Jul 20 2020 at 04:03)</a>:</h4>
<p>still breaks :(</p>



<a name="204384816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384816">(Jul 20 2020 at 04:03)</a>:</h4>
<p>although if it wasn't the right <code>DefId</code>- oh right, <code>type_of(ctor_def_id)</code> for an unit constructor still gives you the original type</p>



<a name="204384819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384819">(Jul 20 2020 at 04:03)</a>:</h4>
<div class="codehilite"><pre><span></span><code>[DEBUG rustdoc::passes::collect_intra_doc_links] considering explicit impl for trait
DefId(2:1636 ~ core[92f6]::clone[0]::Clone[0])
[DEBUG rustdoc::passes::collect_intra_doc_links] considering item (DefId(2:1637 ~ cor
e[92f6]::clone[0]::Clone[0]::clone[0]), Fn)
[DEBUG rustdoc::passes::collect_intra_doc_links] considering type &amp;T with kind Ref(ReEarlyBound(0, &#39;_), T, Not)
[DEBUG rustdoc::passes::collect_intra_doc_links] considering type &amp;mut T with kind Ref(ReEarlyBound(0, &#39;_), T, Mut)
[DEBUG rustdoc::passes::collect_intra_doc_links] considering type MyStruct with kind Adt(MyStruct, [])
</code></pre></div>


<div class="codehilite"><pre><span></span><code><span class="sd">/// Link to [MyStruct], [MyStruct::clone]</span>
<span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">MyStruct</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">foo</span>: <span class="p">()</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="nb">Clone</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">MyStruct</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">clone</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">MyStruct</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="204384820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384820">(Jul 20 2020 at 04:03)</a>:</h4>
<p>okay print the <code>Res</code> / <code>DefId</code> you're starting from</p>



<a name="204384873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384873">(Jul 20 2020 at 04:04)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> there really isn't anything else the type can be. the <code>DefId</code> you have however might be not the <code>struct</code> one</p>



<a name="204384878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384878">(Jul 20 2020 at 04:04)</a>:</h4>
<p>but rather <code>S</code>'s unit constructor</p>



<a name="204384886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384886">(Jul 20 2020 at 04:05)</a>:</h4>
<p>however, why would local trait work</p>



<a name="204384894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384894">(Jul 20 2020 at 04:05)</a>:</h4>
<p>ohh</p>



<a name="204384899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384899">(Jul 20 2020 at 04:05)</a>:</h4>
<p>wait yeah that's confusing</p>



<a name="204384904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384904">(Jul 20 2020 at 04:05)</a>:</h4>
<p>just print it, we'll know when we see it</p>



<a name="204384946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384946">(Jul 20 2020 at 04:06)</a>:</h4>
<p>(it might only affect the <code>struct MyStruct;</code> case)</p>



<a name="204384953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384953">(Jul 20 2020 at 04:06)</a>:</h4>
<div class="codehilite"><pre><span></span><code>[DEBUG rustdoc::passes::collect_intra_doc_links] comparing type MyStruct with kind Adt(MyStruct, []) against def_id DefId(0:3 ~ str_from[8787]::MyStruct[0])
</code></pre></div>



<a name="204384959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384959">(Jul 20 2020 at 04:06)</a>:</h4>
<p>looks right to me?</p>



<a name="204384965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384965">(Jul 20 2020 at 04:06)</a>:</h4>
<p>okay just print the <code>DefId</code> in the <code>ty::Adt</code>, and also the comparison result</p>



<a name="204384967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384967">(Jul 20 2020 at 04:06)</a>:</h4>
<p>this is for <code>pub struct MyStruct { foo: () }</code></p>



<a name="204384971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384971">(Jul 20 2020 at 04:07)</a>:</h4>
<p>how sure are you that the comparison <em>doesn't</em> succeed?</p>



<a name="204384975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384975">(Jul 20 2020 at 04:07)</a>:</h4>
<p>heck it's not generic, the <code>==</code> will likely work :P</p>



<a name="204384983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384983">(Jul 20 2020 at 04:07)</a>:</h4>
<p>yeah even if constructors were involved, <code>impl_self_ty == ty</code> would return <code>true</code>, sorry for the derail</p>



<a name="204384997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204384997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204384997">(Jul 20 2020 at 04:08)</a>:</h4>
<p>so it must be something else that's breaking it</p>



<a name="204385029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385029">(Jul 20 2020 at 04:08)</a>:</h4>
<p>watch me accidentally forget to add it to the candidates or something lol</p>



<a name="204385037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385037">(Jul 20 2020 at 04:08)</a>:</h4>
<p>here's the code so I have more eyes on it:</p>
<div class="codehilite"><pre><span></span><code><span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">trait_ref</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">cx</span><span class="p">.</span><span class="n">tcx</span><span class="p">.</span><span class="n">impl_trait_ref</span><span class="p">(</span><span class="n">impl_</span><span class="p">).</span><span class="n">expect</span><span class="p">(</span><span class="s">&quot;this is not an inherent impl&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">                </span><span class="c1">// Check if these are the same type.</span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">impl_type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">trait_ref</span><span class="p">.</span><span class="n">self_ty</span><span class="p">();</span><span class="w"></span>
<span class="w">                </span><span class="n">debug</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;comparing type {} with kind {:?} against def_id {:?}&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">impl_type</span><span class="p">,</span><span class="w"> </span><span class="n">impl_type</span><span class="p">.</span><span class="n">kind</span><span class="p">,</span><span class="w"> </span><span class="n">did</span><span class="p">);</span><span class="w"></span>
<span class="w">                </span><span class="c1">// Fast path: if this is a primitive simple `==` will work</span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">same_type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">impl_type</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">ty</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="k">match</span><span class="w"> </span><span class="n">impl_type</span><span class="p">.</span><span class="n">kind</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="c1">// Check if these are the same def_id</span>
<span class="w">                    </span><span class="n">TyKind</span>::<span class="n">Adt</span><span class="p">(</span><span class="n">def</span><span class="p">,</span><span class="w"> </span><span class="n">_</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                        </span><span class="n">debug</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;adt did: {:?}&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">def</span><span class="p">.</span><span class="n">did</span><span class="p">);</span><span class="w"></span>
<span class="w">                        </span><span class="n">def</span><span class="p">.</span><span class="n">did</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">did</span><span class="w"></span>
<span class="w">                    </span><span class="p">}</span><span class="w"></span>
<span class="w">                    </span><span class="n">TyKind</span>::<span class="n">Foreign</span><span class="p">(</span><span class="n">def_id</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">def_id</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">did</span><span class="p">,</span><span class="w"></span>
<span class="w">                    </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w"></span>
<span class="w">                </span><span class="p">};</span><span class="w"></span>
<span class="w">                </span><span class="k">if</span><span class="w"> </span><span class="n">same_type</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="c1">// We found it!</span>
<span class="w">                    </span><span class="n">debug</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;found a match!&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">                    </span><span class="n">candidates</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="n">assoc_item</span><span class="p">);</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="204385046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385046">(Jul 20 2020 at 04:09)</a>:</h4>
<p>and then at the end</p>
<div class="codehilite"><pre><span></span><code><span class="w">    </span><span class="c1">// Cleanup and go home</span>
<span class="w">    </span><span class="nb">Ok</span><span class="p">(</span><span class="n">candidates</span><span class="p">.</span><span class="n">pop</span><span class="p">().</span><span class="n">map</span><span class="p">(</span><span class="o">|</span><span class="p">(</span><span class="n">_</span><span class="p">,</span><span class="w"> </span><span class="n">kind</span><span class="p">)</span><span class="o">|</span><span class="w"> </span><span class="n">kind</span><span class="p">))</span><span class="w"></span>
</code></pre></div>



<a name="204385051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385051">(Jul 20 2020 at 04:09)</a>:</h4>
<p>oh god damn it</p>
<div class="codehilite"><pre><span></span><code><span class="p">[</span><span class="n">DEBUG</span><span class="w"> </span><span class="n">rustdoc</span>::<span class="n">passes</span>::<span class="n">collect_intra_doc_links</span><span class="p">]</span><span class="w"> </span><span class="n">comparing</span><span class="w"> </span><span class="k">type</span> <span class="nc">MyStruct</span><span class="w"> </span><span class="n">with</span><span class="w"> </span><span class="n">kind</span><span class="w"> </span><span class="n">Ad</span><span class="w"></span>
<span class="n">t</span><span class="p">(</span><span class="n">MyStruct</span><span class="p">,</span><span class="w"> </span><span class="p">[])</span><span class="w"> </span><span class="n">against</span><span class="w"> </span><span class="n">def_id</span><span class="w"> </span><span class="n">DefId</span><span class="p">(</span><span class="mi">0</span>:<span class="mi">3</span><span class="w"> </span><span class="o">~</span><span class="w"> </span><span class="n">str_from</span><span class="p">[</span><span class="mi">8787</span><span class="p">]</span>::<span class="n">MyStruct</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="w"></span>
<span class="p">[</span><span class="n">DEBUG</span><span class="w"> </span><span class="n">rustdoc</span>::<span class="n">passes</span>::<span class="n">collect_intra_doc_links</span><span class="p">]</span><span class="w"> </span><span class="n">found</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="k">match</span><span class="o">!</span><span class="w"></span>
</code></pre></div>



<a name="204385054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385054">(Jul 20 2020 at 04:09)</a>:</h4>
<p>so it's a bug somewhere else lol</p>



<a name="204385107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385107">(Jul 20 2020 at 04:10)</a>:</h4>
<p>there we go</p>



<a name="204385169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385169">(Jul 20 2020 at 04:12)</a>:</h4>
<p>wait wtf</p>



<a name="204385170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385170">(Jul 20 2020 at 04:12)</a>:</h4>
<p>my debugging isn't showing up outside this function</p>



<a name="204385172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385172">(Jul 20 2020 at 04:12)</a>:</h4>
<div class="codehilite"><pre><span></span><code>                    // Check if item_name belogns to `impl SomeTrait for SomeItem`
                    // This gives precedence to `impl SomeItem`:
                    // Although having both would be ambiguous, use impl version for compat. sake.
                    // To handle that properly resolve() would have to support
                    // something like [`ambi_fn`](&lt;SomeStruct as SomeTrait&gt;::ambi_fn)
                    if kind.is_none() {
                        kind = resolve_associated_trait_item(did, item_name, ns, &amp;self.cx)?;
                    }
                    debug!(&quot;got associated item kind {:?}&quot;, kind);
</code></pre></div>



<a name="204385173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385173">(Jul 20 2020 at 04:12)</a>:</h4>
<p>'got associated item kind' just isn't in the log at all</p>



<a name="204385187"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385187" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385187">(Jul 20 2020 at 04:13)</a>:</h4>
<p>and I only call this function from here so it's definitely running</p>



<a name="204385243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385243">(Jul 20 2020 at 04:15)</a>:</h4>
<p>oh hold on I have a sinking suspicion that it's reporting the wrong error for multiple matches</p>



<a name="204385300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385300">(Jul 20 2020 at 04:16)</a>:</h4>
<p>god damn it people</p>
<div class="codehilite"><pre><span></span><code><span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">hir_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">match</span><span class="w"> </span><span class="n">cx</span><span class="p">.</span><span class="n">as_local_hir_id</span><span class="p">(</span><span class="n">item</span><span class="p">.</span><span class="n">def_id</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="nb">Some</span><span class="p">(</span><span class="n">hir_id</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">hir_id</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="nb">None</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="c1">// If non-local, no need to check anything.</span>
<span class="w">            </span><span class="k">return</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">};</span><span class="w"></span>
</code></pre></div>



<a name="204385303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385303">(Jul 20 2020 at 04:16)</a>:</h4>
<p>this is in the error reporting for an ambiguous link</p>



<a name="204385346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385346">(Jul 20 2020 at 04:18)</a>:</h4>
<p>presumably <code>struct_span_lint_hir</code> has a counterpart that takes DefIds?</p>



<a name="204385349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385349">(Jul 20 2020 at 04:18)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> highly suspecting <code>item.def_id</code> is not what you want to emit the lint on</p>



<a name="204385358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385358">(Jul 20 2020 at 04:19)</a>:</h4>
<p>it can't possibly not be local</p>



<a name="204385359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385359">(Jul 20 2020 at 04:19)</a>:</h4>
<p>this is a good point</p>



<a name="204385377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385377">(Jul 20 2020 at 04:19)</a>:</h4>
<p>the <code>HirId</code> lints take is the thing in the local crate you want to warn about</p>



<a name="204385381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385381">(Jul 20 2020 at 04:19)</a>:</h4>
<p>unless it's a re-export, whic it's not</p>



<a name="204385385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385385">(Jul 20 2020 at 04:19)</a>:</h4>
<p>then you need to pass the reexport <code>HirId</code>, or silence it</p>



<a name="204385386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385386">(Jul 20 2020 at 04:19)</a>:</h4>
<p>pick your poison :P</p>



<a name="204385427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385427">(Jul 20 2020 at 04:20)</a>:</h4>
<p>I'll worry about re-exports later</p>



<a name="204385429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385429">(Jul 20 2020 at 04:20)</a>:</h4>
<p>how did that trigger here though?</p>



<a name="204385431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385431">(Jul 20 2020 at 04:20)</a>:</h4>
<p>with just a local struct</p>



<a name="204385440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385440">(Jul 20 2020 at 04:21)</a>:</h4>
<p>uhh apparently it didn't</p>



<a name="204385442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385442">(Jul 20 2020 at 04:21)</a>:</h4>
<p>I'm <em>so</em> confused</p>



<a name="204385453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385453">(Jul 20 2020 at 04:22)</a>:</h4>
<p>let me try <code>    assert!(candidates.len() &gt;= 2);</code></p>



<a name="204385491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385491">(Jul 20 2020 at 04:22)</a>:</h4>
<p>I think it won't behave properly if there are no candidates</p>



<a name="204385510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385510">(Jul 20 2020 at 04:23)</a>:</h4>
<p>nope, no assertion failure</p>



<a name="204385514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385514">(Jul 20 2020 at 04:23)</a>:</h4>
<p>ugh I hate rustdoc</p>



<a name="204385555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385555">(Jul 20 2020 at 04:24)</a>:</h4>
<p>oh ffs</p>
<div class="codehilite"><pre><span></span><code><span class="w"> </span><span class="n">value_ns</span>: <span class="nc">match</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">resolve</span><span class="p">(</span><span class="w"></span>
<span class="w">                                </span><span class="n">path_str</span><span class="p">,</span><span class="w"></span>
<span class="w">                                </span><span class="n">disambiguator</span><span class="p">,</span><span class="w"></span>
<span class="w">                                </span><span class="n">ValueNS</span><span class="p">,</span><span class="w"></span>
<span class="w">                                </span><span class="o">&amp;</span><span class="n">current_item</span><span class="p">,</span><span class="w"></span>
<span class="w">                                </span><span class="n">base_node</span><span class="p">,</span><span class="w"></span>
<span class="w">                                </span><span class="o">&amp;</span><span class="n">extra_fragment</span><span class="p">,</span><span class="w"></span>
<span class="w">                            </span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                                </span><span class="nb">Err</span><span class="p">(</span><span class="n">ErrorKind</span>::<span class="n">AnchorFailure</span><span class="p">(</span><span class="n">msg</span><span class="p">))</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                                    </span><span class="n">anchor_failure</span><span class="p">(</span><span class="n">cx</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">item</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">ori_link</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">dox</span><span class="p">,</span><span class="w"> </span><span class="n">link_range</span><span class="p">,</span><span class="w"> </span><span class="n">msg</span><span class="p">);</span><span class="w"></span>
<span class="w">                                    </span><span class="k">continue</span><span class="p">;</span><span class="w"></span>
<span class="w">                                </span><span class="p">}</span><span class="w"></span>
<span class="w">                                </span><span class="n">x</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">x</span><span class="p">.</span><span class="n">ok</span><span class="p">(),</span><span class="w"></span>
<span class="w">                            </span><span class="p">}</span><span class="w"></span>
<span class="w">                            </span><span class="p">.</span><span class="n">and_then</span><span class="p">(</span><span class="o">|</span><span class="p">(</span><span class="n">res</span><span class="p">,</span><span class="w"> </span><span class="n">fragment</span><span class="p">)</span><span class="o">|</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                                </span><span class="c1">// Constructors are picked up in the type namespace.</span>
<span class="w">                                </span><span class="k">match</span><span class="w"> </span><span class="n">res</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                                    </span><span class="n">Res</span>::<span class="n">Def</span><span class="p">(</span><span class="n">DefKind</span>::<span class="n">Ctor</span><span class="p">(</span><span class="o">..</span><span class="p">),</span><span class="w"> </span><span class="n">_</span><span class="p">)</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Res</span>::<span class="n">SelfCtor</span><span class="p">(</span><span class="o">..</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="nb">None</span><span class="p">,</span><span class="w"></span>
<span class="w">                                    </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="k">match</span><span class="w"> </span><span class="p">(</span><span class="n">fragment</span><span class="p">,</span><span class="w"> </span><span class="n">extra_fragment</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                                        </span><span class="p">(</span><span class="nb">Some</span><span class="p">(</span><span class="n">fragment</span><span class="p">),</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">_</span><span class="p">))</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                                            </span><span class="c1">// Shouldn&#39;t happen but who knows?</span>
<span class="w">                                            </span><span class="nb">Some</span><span class="p">((</span><span class="n">res</span><span class="p">,</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">fragment</span><span class="p">)))</span><span class="w"></span>
<span class="w">                                        </span><span class="p">}</span><span class="w"></span>
<span class="w">                                        </span><span class="p">(</span><span class="n">fragment</span><span class="p">,</span><span class="w"> </span><span class="nb">None</span><span class="p">)</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="p">(</span><span class="nb">None</span><span class="p">,</span><span class="w"> </span><span class="n">fragment</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                                            </span><span class="nb">Some</span><span class="p">((</span><span class="n">res</span><span class="p">,</span><span class="w"> </span><span class="n">fragment</span><span class="p">))</span><span class="w"></span>
<span class="w">                                        </span><span class="p">}</span><span class="w"></span>
<span class="w">                                    </span><span class="p">},</span><span class="w"></span>
<span class="w">                                </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="204385559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385559">(Jul 20 2020 at 04:24)</a>:</h4>
<p>it completely ignores the error</p>



<a name="204385564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385564">(Jul 20 2020 at 04:24)</a>:</h4>
<p>it assumes it was a resolution failure <span aria-label="face palm" class="emoji emoji-1f926" role="img" title="face palm">:face_palm:</span></p>



<a name="204385632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385632">(Jul 20 2020 at 04:27)</a>:</h4>
<p>let's just copy/paste 50 lines of code, that seems like a reasonable thing to do</p>



<a name="204385690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385690">(Jul 20 2020 at 04:28)</a>:</h4>
<p>lmao there we go</p>
<div class="codehilite"><pre><span></span><code>warning: `MyStruct::clone` is an associated function, an associated function, an associated function, an associated function, and an associated function
</code></pre></div>



<a name="204385694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385694">(Jul 20 2020 at 04:28)</a>:</h4>
<p>well at least it's something</p>



<a name="204385714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385714">(Jul 20 2020 at 04:29)</a>:</h4>
<p>it looks like it's considering the same trait multiple times?</p>



<a name="204385760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385760">(Jul 20 2020 at 04:30)</a>:</h4>
<p>yeah <code>[DEBUG rustdoc::passes::collect_intra_doc_links] considering explicit impl for trait DefId(2:1636 ~ core[92f6]::clone[0]::Clone[0])</code> shows up 5 times</p>



<a name="204385762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385762">(Jul 20 2020 at 04:30)</a>:</h4>
<p>this is coming from <code>all_traits</code></p>



<a name="204385775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385775">(Jul 20 2020 at 04:31)</a>:</h4>
<p>I'm out of time for tonight, I'll pick this back up later</p>



<a name="204385779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385779">(Jul 20 2020 at 04:31)</a>:</h4>
<p>WIP at <a href="https://github.com/rust-lang/rust/pull/74489/">https://github.com/rust-lang/rust/pull/74489/</a> in case you're interested</p>



<a name="204385992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204385992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204385992">(Jul 20 2020 at 04:37)</a>:</h4>
<p>oh and when you get a chance do you know where to find the source for <code>all_traits</code>? All I found was the one in <code>suggest.rs</code> which itself is calling the query, so that's not it.</p>



<a name="204386039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204386039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204386039">(Jul 20 2020 at 04:38)</a>:</h4>
<p>oh it's right next to it lol, compute_all_traits</p>



<a name="204386049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204386049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204386049">(Jul 20 2020 at 04:39)</a>:</h4>
<p>but yeah I think something's buggy there</p>



<a name="204490799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204490799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204490799">(Jul 20 2020 at 22:19)</a>:</h4>
<p>so <span class="user-mention" data-user-id="132040">@Manish Goregaokar</span> suggested that I give up on ambiguity errors for now until there's a way to disambiguate (<a href="https://github.com/rust-lang/rust/issues/74563">https://github.com/rust-lang/rust/issues/74563</a>)</p>



<a name="204490811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204490811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204490811">(Jul 20 2020 at 22:19)</a>:</h4>
<p>I'm currently trying to resolve associated types</p>



<a name="204490858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204490858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204490858">(Jul 20 2020 at 22:20)</a>:</h4>
<p>but something is fishy with <code>for_each_relevant_impl</code></p>



<a name="204490934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204490934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204490934">(Jul 20 2020 at 22:21)</a>:</h4>
<p>it definitely calls it here: <a href="https://github.com/rust-lang/rust/pull/74489/files#diff-2bcad7b16b56ef2ebb92f8e60ae33773R474">https://github.com/rust-lang/rust/pull/74489/files#diff-2bcad7b16b56ef2ebb92f8e60ae33773R474</a><br>
because I'm getting the debug output</p>
<div class="codehilite"><pre><span></span><code>[DEBUG rustdoc::passes::collect_intra_doc_links] looking for associated item named In
put for item DefId(0:3 ~ str_from[8787]::MyStruct[0])
[DEBUG rustdoc::passes::collect_intra_doc_links] considering explicit impl for trait
DefId(0:9 ~ str_from[8787]::T[0])
[DEBUG rustdoc::passes::collect_intra_doc_links] considering item (DefId(0:10 ~ str_from[8787]::T[0]::Input[0]), Type)
[DEBUG rustdoc::passes::collect_intra_doc_links] considering explicit impl for trait DefId(0:12 ~ str_from[8787]::T1[0])
</code></pre></div>



<a name="204490947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204490947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204490947">(Jul 20 2020 at 22:21)</a>:</h4>
<p>but the closure is never called, it skips straight over it as if there are no trait impls!</p>



<a name="204491062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/weird%20issues%20with%20finding%20trait%20implementations/near/204491062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/weird.20issues.20with.20finding.20trait.20implementations.html#204491062">(Jul 20 2020 at 22:23)</a>:</h4>
<p>... I'm being dumb, my test case was wrong lol</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>